﻿namespace Smart.Model
{
    public static class ConstHelper
    {
        public enum AppMode
        {
            AM_MODEL = 0,
            AM_HOTFIX,
            AM_EDITOR,
        }

        public static string ModeName(AppMode mode)
        {
            switch(mode)
            {
                case AppMode.AM_EDITOR:
                    return "Editor";
                case AppMode.AM_MODEL:
                    return "Model";
                case AppMode.AM_HOTFIX:
                    return "Hotfix";
            }
            return "Hotfix";
        }

        public static string AssemblName(AppMode mode)
        {
            switch (mode)
            {
                case AppMode.AM_EDITOR:
                    return "Smart.Editor.Init";
                case AppMode.AM_MODEL:
                    return "Smart.Model.Init";
                case AppMode.AM_HOTFIX:
                    return "Smart.Hotfix.Init";
            }
            return "Smart.Hotfix.Init";
        }

        public static float FillAmount(this float value,int low,int high)
        {
            return 0.01f * (low + (high - low) * value);
        }

        public const string AppVersionConfigKey = "AppVersionConfigKey";
        public const string AppVersionConfigName = "versionConfig.txt";

        static string _application_store_path = string.Empty;
        public static string ApplicationPersistentRoot
        {
            get
            {
                if(string.IsNullOrEmpty(_application_store_path))
                {
                    _application_store_path = PathHelper.getPersistentPath("Application", false);
                }
                return _application_store_path;
            }
        }

        public const string HotfixCodeBundleName = "game.code";
        public const string TableBundleName = "game.table";
        public const int GAME_BASE_MODULE = 1001;

#if Test
        public const string AppFileServerUrl = @"https://au-dev-kids.oss-cn-hangzhou.aliyuncs.com/Smart/";
#elif LocalNet
        public const string AppFileServerUrl = @"http://127.0.0.1:8080/";
#else
        public const string AppFileServerUrl = @"https://resourcekids.66uu.cn/Smart/";
#endif
    }
}